package languageacquisition;

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JTable;
import javax.swing.JList;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.AbstractTableModel;
import java.lang.Object;
import java.util.HashMap;

import javax.swing.table.TableColumn;

import languageacquisition.ontology.LanguageSymbol;
import languageacquisition.ontology.Property;

public class LearningAgentUI extends JFrame {

	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	private JTable dictionaryTable = null;
	
	private PopulationAgent myAgent;
	/**
	 * This is the default constructor
	 */
	public LearningAgentUI(PopulationAgent agent) {
		super();
		myAgent = agent;
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(700, 500);
		this.setContentPane(getJContentPane());
		this.setTitle("Symbol Grounding for New Agent");
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			BorderLayout borderLayout = new BorderLayout();
			borderLayout.setHgap(3);
			borderLayout.setVgap(3);
			jContentPane = new JPanel();
			jContentPane.setLayout(borderLayout);
			jContentPane.add(getDictionaryTable(), BorderLayout.WEST);
		}
		return jContentPane;
	}

	/**
	 * This method initializes dictionaryTable	
	 * 	
	 * @return javax.swing.JTable	
	 */
	private JTable getDictionaryTable() {
		if (dictionaryTable == null) {
			dictionaryTable = new JTable();
			dictionaryTable.setModel(new DictionaryTableModel(myAgent.getDictionary()));
			dictionaryTable.setRowSelectionAllowed(false);
			dictionaryTable.setRowHeight(30);
			dictionaryTable.setPreferredSize(new Dimension(660, 330));
		}
		return dictionaryTable;
	}
	
	public void updateDictionaryTable() {
		dictionaryTable.repaint();
	}

}  //  @jve:decl-index=0:visual-constraint="49,15"
